<div class="dialog-content-wrapper">
    <mat-toolbar matDialogTitle class="mat-accent m-0">
        <mat-toolbar-row fxFlex fxLayout="row" fxLayoutAlign="space-between center">
            <span class="title dialog-title">{{dialogTitle}}-{{permit.name}}</span>
            <button mat-icon-button (click)="matDialogRef.close()" aria-label="Close dialog">
                <mat-icon>close</mat-icon>
            </button>
        </mat-toolbar-row>
    </mat-toolbar>

    <div mat-dialog-content class="p-16 pb-0 m-0" basePerfectScrollbar>

        <form [formGroup]="permitForm" class="event-form w-100-p" fxLayout="column" fxFlex>
            <mat-form-field appearance="outline" class="w-100-p">
                <mat-label>权限名称</mat-label>
                <input matInput
                       name="权限名称"
                       formControlName="name"
                       required>
            </mat-form-field>

            <mat-form-field appearance="outline" class="w-100-p">
                <mat-label>权限路由</mat-label>
                <input matInput
                       name="权限路由"
                       formControlName="routing"
                       required>
            </mat-form-field>

            <mat-form-field appearance="outline" class="w-100-p">
                <mat-label>请求类型</mat-label>

                    <mat-select formControlName="method"
                                required>
                        <mat-option value="GET">GET</mat-option>
                        <mat-option value="POST">POST</mat-option>
                        <mat-option value="PUT">PUT</mat-option>
                        <mat-option value="DELETE">DELETE</mat-option>
                    </mat-select>

            </mat-form-field>

            <div fxLayout="row" fxLayoutAlign="start start">
                <mat-form-field appearance="outline" fxFlex>
                    <mat-label>请求类型</mat-label>
                    <input name="请求类型" formControlName="method" matInput>
                </mat-form-field>
            </div>

            <mat-form-field appearance="outline" class="w-100-p">
                <mat-label>请求类型</mat-label>
                <input matInput
                       name="请求类型"
                       formControlName="method"
                       required>
            </mat-form-field>


            <mat-form-field appearance="outline" class="w-100-p">
                <mat-label>请求类型</mat-label>
                <input matInput
                       name="请求类型"
                       formControlName="method"
                       required>
            </mat-form-field>

        </form>

    </div>

    <div mat-dialog-actions class="m-0 p-16" fxLayout="row" fxLayoutAlign="end center">

        <button *ngIf="action === 'edit'"
                mat-button
                class="mr-8"
                (click)="matDialogRef.close(['delete',permitForm])"
                aria-label="Delete"
                matTooltip="Delete">
            DELETE
        </button>

        <button *ngIf="action !== 'edit'"
                mat-button
                class="save-button"
                (click)="matDialogRef.close(permitForm)"
                [disabled]="permitForm.invalid"
                aria-label="SAVE">
            ADD
        </button>

        <button *ngIf="action === 'edit'"
                mat-button
                class="save-button"
                (click)="matDialogRef.close(['save',permitForm])"
                [disabled]="permitForm.invalid"
                aria-label="SAVE">
            SAVE
        </button>

    </div>
</div>
